package Stream.test1;

import java.util.stream.Stream;

public class DayctStream {

    //动态流
    public static void main(String[] args) {
        //流构造器
        Stream.Builder<Object> builder = Stream.builder();
        builder.add("a").add("b");
        if (Math.random() > 0.5) {
            builder.add("c");
        }
        //构造一个流
        Stream<Object> build = builder.build();
        /*在这之后再add构造器会报错
        builder.add("d");*/
        build.forEach(System.out::println);
    }
}
